/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package DataModel;
import java.util.HashMap;

/**
 *
 * @author Carlos
 */
public class Organization extends OrganizationSummary
{

    // <editor-fold defaultstate="collapsed" desc="Attributes">
    private String _code;
    private String _legalId;
    private String _address;
    private String _postOfficeBox;
    private String[] _phones;
    private HashMap<Integer, User> _responsibles;
    private User[] _responsiblesArray;
    private Country _region;
    // </editor-fold>

    // <editor-fold defaultstate="collapsed" desc="Constructor">
     public Organization(String _name, String _code, int _id, String _legalId, String _address, String _postOfficeBox, String[] _phones, User[] _responsibles, Country _region) {
         super(_id, _name);
        this._code = _code;
        this._legalId = _legalId;
        this._address = _address;
        this._postOfficeBox = _postOfficeBox;
        this._phones = _phones;
        this._responsibles = new HashMap<Integer, User>();
        for(int responsibleIndex = 0; responsibleIndex < _responsibles.length; responsibleIndex++)
        {
            User currentUser = _responsibles[responsibleIndex];
            this._responsibles.put(currentUser.getId(), currentUser);
        }
        _responsiblesArray = _responsibles;
        this._region = _region;
    }
    // </editor-fold>

    // <editor-fold defaultstate="collapsed" desc="Properties">
    public String getAddress() {
        return _address;
    }

    public String getCode() {
        return _code;
    }

    public String getLegalId() {
        return _legalId;
    }

    public String[] getPhones() {
        return _phones;
    }

    public String getPostOfficeBox() {
        return _postOfficeBox;
    }

    public Country getRegion() {
        return _region;
    }

    public User[] getResponsibles()
    {
        return _responsiblesArray;
    }
     // </editor-fold>

    // <editor-fold defaultstate="collapsed" desc="Methods">
    public boolean hasResponsible(int userId)
    {
        return _responsibles.containsKey(userId);
    }

    public User getResponsible(int userId)
    {
        if(hasResponsible(userId))
            return _responsibles.get(userId);
        else
            return null;
    }
    // </editor-fold>

}
